<template>
  <div>
    <h1>片区管理</h1>
  </div>
</template>

<script setup lang="ts">
function State(target: object, propertyKey: string) {
  let key =`__${propertyKey}`;
  Object.defineProperty(target,propertyKey,{
    get(){
      console.log(`访问了__${propertyKey}`)  
      return this[key];
    },
    set(newValue){
      console.log(`${propertyKey}的最新值为：${newValue}`)
      this[key] = newValue
    }
  })
}



class Person {
  @State
  name: string; //监听这个东西，当修改和访问的时候就会触发
  age: number;
  static status: string = "1.34";

  constructor(name: string, age: number) {
    this.name = name;
    this.age = age;
  }
  static test<T>(num: T): void{
     
  }

}
let p1 = new Person("胡桃", 18);
</script>